package com.itheima.service;

import com.itheima.dao.BrardDao;
import com.itheima.models.Brand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component("brandService")
public class BrandService {

    @Autowired
    private BrardDao brardDao;

    public List<Brand> find_all(){
        return brardDao.find_all();
    }
    public int create(String name, String tag){
        Brand brand = new Brand();
        brand.setTag(tag);
        brand.setName(name);
        return brardDao.caeate(brand);
    }
    public int update(String name, String tag){
        Brand brand = new Brand();
        brand.setTag(tag);
        brand.setName(name);
        return brardDao.update(brand);
    }
    public int delete(int id){
        return brardDao.delete(id);
    }

}
